// StatTable.h : StatTable is used to keep a list of information regarding the statements in the program.
// Author: Achyut P Balaji
//

#ifndef STAT_TABLE_H
#define STAT_TABLE_H
#include"../../SPA_Data_Types.h"

using namespace std;

typedef vector<STATEMENT_INDEX> STMT_VCTR;
typedef vector<STRING> STRNG_VCTR;
typedef INTEGER ASSIGN_INDEX;

class StatTable {
private:

	vector<STATEMENT_INDEX> tempBlockEnd;
	vector<STATEMENT_TYPE> tempStmtType;
	vector<STMT_VCTR> tempNextStmt;
	vector<STRING> tempPattern;
	vector<STATEMENT_INDEX> tempParent;
	vector<INDEX> tempConditionalVariable;
	
	INTEGER noOfAssign;
	INTEGER noOfWhile;
	INTEGER noOfIf;
	INTEGER noOfCall;

	INTEGER noOfStmts;

	vector<ASSIGN_INDEX> assignNo;

	vector<STATEMENT_INDEX> tempVector;
	
	static StatTable *obj;
	bool initialised;
	StatTable();

public:

	static StatTable* getInstance();
	static StatTable* getFirstInstance();

	BOOLEAN addEntry(STATEMENT_INDEX n,STATEMENT_TYPE type,STATEMENT_INDEX endOfBlock,STATEMENT_INDEX parentStmt,STMT_VCTR nextStmts,STRING patter,INDEX condVar);
	BOOLEAN addNoofStmts(INTEGER n);

	STATEMENT_TYPE getType(STATEMENT_INDEX s);
	STATEMENT_INDEX getBlockEnd(STATEMENT_INDEX s);
	STATEMENT_INDEX getParent(STATEMENT_INDEX s);
	STMT_VCTR* getNext(STATEMENT_INDEX s);
	STRING getPattern(STATEMENT_INDEX s);
	INDEX getConditionVar(STATEMENT_INDEX s);

	INTEGER getNoofStat();
	INTEGER getNoofEachStmt(STATEMENT_TYPE type);
	INTEGER getNoofStmts();

	INTEGER getAssignNumber(STATEMENT_INDEX n);

	void initialise(int assignStmt,int whileStmt,int ifStmt,int procCallStmt);

};

#endif